(function() {
    'use strict';

    angular
        .module('zhserverApp')
        .config(stateConfig);

    stateConfig.$inject = ['$stateProvider'];

    function stateConfig($stateProvider) {
        $stateProvider
        .state('zhUserinfo', {
            parent: 'zhentity',
            url: '/userinfo?page&sort&search',
            ncyBreadcrumb: {
                label: '患者管理'
            },
            data: {
                authorities: ['ROLE_USER'],
                pageTitle: 'zhserverApp.userinfo.home.title'
            },
            views: {
                '@app1': {
                    templateUrl: 'js/entity/userinfo/userinfos2.html',
                    controller: 'UserinfoController',
                    controllerAs: 'vm'
                }
            },
            params: {
                page: {
                    value: '1',
                    squash: true
                },
                sort: {
                    value: 'id,asc',
                    squash: true
                },
                search: null
            },
            resolve: {
                pagingParams: ['$stateParams', 'PaginationUtil', function ($stateParams, PaginationUtil) {
                    return {
                        page: PaginationUtil.parsePage($stateParams.page),
                        sort: $stateParams.sort,
                        predicate: PaginationUtil.parsePredicate($stateParams.sort),
                        ascending: PaginationUtil.parseAscending($stateParams.sort),
                        search: $stateParams.search
                    };
                }],
                translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                    $translatePartialLoader.addPart('userinfo');
                    $translatePartialLoader.addPart('global');
                    return $translate.refresh();
                }]
            }
        })
        .state('zhUserinfo-detail', {
            parent: 'zhentity',
            url: '/userinfo/{id}',
            data: {
                authorities: ['ROLE_USER'],
                pageTitle: 'zhserverApp.userinfo.detail.title'
            },
            views: {
                '@app1': {
                    templateUrl: 'js/entity/userinfo/userinfo-detail.html',
                    controller: 'UserinfoDetailController',
                    controllerAs: 'vm'
                }
            },
            resolve: {
                translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                    $translatePartialLoader.addPart('userinfo');
                    return $translate.refresh();
                }],
                entity: ['$stateParams', 'Userinfo', function($stateParams, Userinfo) {
                    return Userinfo.get({id : $stateParams.id}).$promise;
                }],
                previousState: ["$state", function ($state) {
                    var currentStateData = {
                        name: $state.current.name || 'userinfo',
                        params: $state.params,
                        url: $state.href($state.current.name, $state.params)
                    };
                    return currentStateData;
                }]
            }
        })
        //.state('userinfo-detail.edit', {
        //    parent: 'userinfo-detail',
        //    url: '/detail/edit',
        //    data: {
        //        authorities: ['ROLE_USER']
        //    },
        //    onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
        //        $uibModal.open({
        //            templateUrl: 'app/entities/userinfo/userinfo-dialog.html',
        //            controller: 'UserinfoDialogController',
        //            controllerAs: 'vm',
        //            backdrop: 'static',
        //            size: 'lg',
        //            resolve: {
        //                entity: ['Userinfo', function(Userinfo) {
        //                    return Userinfo.get({id : $stateParams.id}).$promise;
        //                }]
        //            }
        //        }).result.then(function() {
        //            $state.go('^', {}, { reload: false });
        //        }, function() {
        //            $state.go('^');
        //        });
        //    }]
        //})
        //.state('userinfo.new', {
        //    parent: 'userinfo',
        //    url: '/new',
        //    data: {
        //        authorities: ['ROLE_USER']
        //    },
        //    onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
        //        $uibModal.open({
        //            templateUrl: 'app/entities/userinfo/userinfo-dialog.html',
        //            controller: 'UserinfoDialogController',
        //            controllerAs: 'vm',
        //            backdrop: 'static',
        //            size: 'lg',
        //            resolve: {
        //                entity: function () {
        //                    return {
        //                        phonenumber: null,
        //                        birthday: null,
        //                        sex: null,
        //                        nickname: null,
        //                        education: null,
        //                        age: null,
        //                        userresume: null,
        //                        flag: null,
        //                        headimg: null,
        //                        email: null,
        //                        histroy: null,
        //                        id: null
        //                    };
        //                }
        //            }
        //        }).result.then(function() {
        //            $state.go('userinfo', null, { reload: 'userinfo' });
        //        }, function() {
        //            $state.go('userinfo');
        //        });
        //    }]
        //})
        //.state('userinfo.edit', {
        //    parent: 'userinfo',
        //    url: '/{id}/edit',
        //    data: {
        //        authorities: ['ROLE_USER']
        //    },
        //    onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
        //        $uibModal.open({
        //            templateUrl: 'app/entities/userinfo/userinfo-dialog.html',
        //            controller: 'UserinfoDialogController',
        //            controllerAs: 'vm',
        //            backdrop: 'static',
        //            size: 'lg',
        //            resolve: {
        //                entity: ['Userinfo', function(Userinfo) {
        //                    return Userinfo.get({id : $stateParams.id}).$promise;
        //                }]
        //            }
        //        }).result.then(function() {
        //            $state.go('userinfo', null, { reload: 'userinfo' });
        //        }, function() {
        //            $state.go('^');
        //        });
        //    }]
        //})
        .state('zhUserinfo.delete', {
            parent: 'zhUserinfo',
            url: '/{id}/delete',
            data: {
                authorities: ['ROLE_USER']
            },
            onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
                $uibModal.open({
                    templateUrl: 'app/entities/userinfo/userinfo-delete-dialog.html',
                    controller: 'UserinfoDeleteController',
                    controllerAs: 'vm',
                    size: 'md',
                    resolve: {
                        entity: ['Userinfo', function(Userinfo) {
                            return Userinfo.get({id : $stateParams.id}).$promise;
                        }]
                    }
                }).result.then(function() {
                    $state.go('userinfo', null, { reload: 'userinfo' });
                }, function() {
                    $state.go('^');
                });
            }]
        })
            .state('zhUserinfo.new', {
                parent: 'zhentity',
                url: '/new',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    '@app1': {
                        templateUrl: 'js/entity/userinfo/userinfo-create.html',
                        controller: 'UserinfoCreateController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    entity: function () {
                        return {
                            phonenumber: null,
                            birthday: null,
                            sex: null,
                            nickname: null,
                            education: null,
                            age: null,
                            userresume: null,
                            flag: null,
                            headimg: null,
                            email: null,
                            histroy: null,
                            id: null
                        };
                    }
                }
            })
            .state('zhUserinfo.edit', {
                parent: 'zhentity',
                url: '/{id}/edit',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    '@app1': {
                        templateUrl: 'js/entity/userinfo/userinfo-create.html',
                        controller: 'UserinfoCreateController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    entity:  function(Userinfo,$stateParams) {
                        return Userinfo.get({id : $stateParams.id});
                    }
                }
            })
            .state('zhUserinfo-detail.edit', {
                parent: 'zhUserinfo-detail',
                url: '/detail/edit',
                data: {
                    authorities: ['ROLE_USER']
                },views: {
                    '@app1': {
                        templateUrl: 'js/entity/userinfo/userinfo-create.html',
                        controller: 'UserinfoCreateController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    entity:  function(Userinfo,$stateParams) {
                        return Userinfo.get({id : $stateParams.id});
                    }
                }
            })
            .state('zhUserinfocreate', {
                parent: 'zhentity',
                url: '/create-user',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    '@app1': {
                        templateUrl: 'js/entity/userinfo/userinfo-create.html',
                        controller: 'UserinfoCreateController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    entity: function () {
                        return {
                            phonenumber: null,
                            birthday: null,
                            sex: null,
                            nickname: null,
                            education: null,
                            age: null,
                            userresume: null,
                            flag: null,
                            headimg: null,
                            email: null,
                            histroy: null,
                            id: null
                        };
                    }
                }

            })

        ;
    }

})();
